package gentle.controller;


import com.baomidou.mybatisplus.plugins.Page;
import gentle.base.BaseController;
import gentle.entity.*;
import gentle.exception.BizExceptionEnum;
import gentle.exception.BussinessException;
import gentle.factory.PageFactory;
import gentle.service.IDoctorLookedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;


/**
 * 医生
 *
 * @author py
 * @Date 2018年4月19日23:15:54
 */
@RestController
@RequestMapping("doctorLooked")
public class DoctorLookedController extends BaseController {

    @Autowired
    IDoctorLookedService doctorLookedService;

    /**
     *  医生集合和数据源
     */
    @RequestMapping(value = "/getListconsultRestDoctorList/{timeSlot}")
    @ResponseBody
    public ConsultantAggregateInfo getListconsultRestDoctorList(@PathVariable String timeSlot) {
        ConsultantAggregateInfo consultantAggregateInfo=new ConsultantAggregateInfo();
        consultantAggregateInfo.setConsultantdInfoList(doctorLookedService.getListed(timeSlot));
        consultantAggregateInfo.setConsultantsInfoList(doctorLookedService.consultRestDoctor(timeSlot));
        return consultantAggregateInfo;
    }

    /**
     * 统计医生收费金额
     */
    @RequestMapping(value = "/totalMoney", method = RequestMethod.GET)
    @ResponseBody
    public double totalMoney(String reach, String payServiceName, String startTime, String endTime, String abbreviation,String userAccount, String areaAbbreviation) throws Exception {
        return doctorLookedService.totalMoney(reach,payServiceName,startTime,endTime,abbreviation,userAccount,areaAbbreviation);
    }

    /**
     * 统计查询
     */
    @RequestMapping(value = "/alltotal", method = RequestMethod.GET)
    @ResponseBody
    public List<DoctorLookedInfo> alltotal(String reach,String revisitStatus,String startRevisitTime,String endRevisitTime,String revisit,String createName,String startCreateTime,String endCreateTime, String abbreviation, String outpatientName) throws Exception {
        return doctorLookedService.alltotal( reach, revisitStatus, startRevisitTime, endRevisitTime, revisit, createName, startCreateTime, endCreateTime,  abbreviation,  outpatientName);
    }

    /**
     * 医生划价预览表格
     */
    @RequestMapping("/getDoctorChargePrice")
    @ResponseBody
    public Object getDoctorChargePrice(SearchDoctorLookedInfo info,String abbreviation, HttpServletRequest request) {
        Page<DoctorLookedInfo> page = new PageFactory<DoctorLookedInfo>().defaultPage();
        try {
            List<DoctorLookedInfo> list = doctorLookedService.selectDoctorChargePrice(page, info , abbreviation);
            page.setRecords(list);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return super.packForBT(page);
    }

    /**
     * 得到医生收费明细
     */
    @RequestMapping("/getChargeSchedule")
    @ResponseBody
    public Object getChargeSchedule(SearchDoctorLookedInfo info,String userAccount,String abbreviation,String areaAbbreviation) {
        Page<DoctorLookedInfo> page = new PageFactory<DoctorLookedInfo>().defaultPage();
        try {
            List<DoctorLookedInfo> list = doctorLookedService.selectChargeSchedule(page, info ,userAccount ,abbreviation,areaAbbreviation);
            page.setRecords(list);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return super.packForBT(page);
    }

    //查询病历
    @RequestMapping(value = "/getCaseData", method = RequestMethod.POST)
    @ResponseBody
    public List<CaseInfo> getArchivings(String id) throws Exception {
        return doctorLookedService.getArchivings(id);
    }

    //删除随访模板
    @RequestMapping(value = "/deleteSfById", method = RequestMethod.POST)
    @ResponseBody
    public int deleteSfById(String id) throws Exception {
        return doctorLookedService.deleteSfById(id);
    }

    //删除矫治原则模板
    @RequestMapping(value = "/deleteJzById", method = RequestMethod.POST)
    @ResponseBody
    public int deleteJzById(String id) throws Exception {
        return doctorLookedService.deleteJzById(id);
    }

    //删除设计方案模板
    @RequestMapping(value = "/deleteSjById", method = RequestMethod.POST)
    @ResponseBody
    public int deleteSjById(String id) throws Exception {
        return doctorLookedService.deleteSjById(id);
    }

    //删除随访结果模板
    @RequestMapping(value = "/deleteJgById", method = RequestMethod.POST)
    @ResponseBody
    public int deleteJgById(String id) throws Exception {
        return doctorLookedService.deleteJgById(id);
    }

    //修改预约备注提交
    @RequestMapping(value = "/updateRemarksReservationOk", method = RequestMethod.POST)
    @ResponseBody
    public int updateRemarksReservationOk(String customerId, String remarksReservation, String userAccount, String userId, String abbreviation, String outpatientName) throws Exception {
        return doctorLookedService.updateRemarksReservationOk(customerId, remarksReservation, userAccount, userId, abbreviation, outpatientName);
    }

    //修改看诊项目
    @RequestMapping(value = "/updAppointmentPayServiceOK", method = RequestMethod.POST)
    @ResponseBody
    public int updAppointmentPayServiceOK(String customerId, String projectData, String userAccount, String userId, String abbreviation, String outpatientName) throws Exception {
        return doctorLookedService.updAppointmentPayServiceOK( customerId, projectData, userAccount, userId, abbreviation, outpatientName);
    }

    //查看改动日志
    @RequestMapping("/getUpdateLogList/{customerId}")
    @ResponseBody
    public Object getUpdateLogList(@PathVariable String customerId,String abbreviation, SearchCustomerReservationsUpdateLogInfo info, HttpServletRequest request) {
        Page<CustomerReservationsUpdateLogInfo> page = new PageFactory<CustomerReservationsUpdateLogInfo>().defaultPage();
        try {
            CustomerInfo cinfo = doctorLookedService.selectOneById(customerId,abbreviation);
            if (cinfo != null) {
                info.setCustomerId(customerId);
                info.setCustomerName(cinfo.getCustomerName());
                info.setCustomerPhone(cinfo.getCustomerPhone());
            }
            info.setStartIndex(page.getSize() * (page.getCurrent() - 1));
            info.setLimitIndex(page.getSize());
            page.setCurrent(0);
            List<CustomerReservationsUpdateLogInfo> list = doctorLookedService.getList(page, info);
            if (list.size() == 0) {
                info.setStartIndex(0);
                list = doctorLookedService.getList(page, info);
            }
            page.setRecords(list);
            page.setTotal(doctorLookedService.getQueryPagesCount(page, info));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return super.packForBT(page);
    }


    //查看 随访 改动日志
    @RequestMapping("/getDoctorDailyLogList/{reservationsId}")
    @ResponseBody
    public Object getDoctorDailyLogList(@PathVariable String reservationsId, String abbreviation,SearchDoctorDailyLog info, HttpServletRequest request) {
        Page<DoctorDailyLog> page = new PageFactory<DoctorDailyLog>().defaultPage();
        try {
            CustomerInfo cinfo = doctorLookedService.selectOneByReservationId(reservationsId,abbreviation);
            if (cinfo != null) {
                info.setReservationsId(reservationsId);
            }
            info.setStartIndex(page.getSize() * (page.getCurrent() - 1));
            info.setLimitIndex(page.getSize());
            page.setCurrent(0);
            List<DoctorDailyLog> list = doctorLookedService.getDocotrDailyLogList(page, info);
            if (list.size() == 0) {
                info.setStartIndex(0);
                list = doctorLookedService.getDocotrDailyLogList(page, info);
            }
            page.setRecords(list);
            page.setTotal(doctorLookedService.getDailyPageCount(page, info));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return super.packForBT(page);
    }

    //病历模板层级添加
    @RequestMapping(value = "/add_Oblogs", method = RequestMethod.POST)
    @ResponseBody
    public int add_Oblogs(String oneClass, String twoClass,String userAccount) {
        return doctorLookedService.add_Oblogs(oneClass,twoClass,userAccount);
    }

    // 病历模板另存为
    @RequestMapping(value = "/addCaseContent", method = RequestMethod.POST)
    @ResponseBody
    public int addCaseContent(String caseName, String zhushu, String nowMedicalHistory, String beforeMedicalHistory
            , String mouthCheck, String auxiliaryCheck, String remedyPlan, String diagnose
            , String dispose, String doctorAdvice, String oblogid,String userAccount) {
        return doctorLookedService.addCaseContent( caseName, zhushu, nowMedicalHistory, beforeMedicalHistory, mouthCheck, auxiliaryCheck, remedyPlan, diagnose
                , dispose, doctorAdvice, oblogid, userAccount);
    }

    // 获取病历模板信息
    @RequestMapping(value = "/getCaseContent", method = RequestMethod.POST)
    @ResponseBody
    public CaseInfo getCaseContent(String id) {
        return doctorLookedService.getCaseContent(id);
    }


    //删除模板
    @RequestMapping(value = "/deleteCaseContent", method = RequestMethod.POST)
    @ResponseBody
    public int deleteCaseContent(String id,String userAccount) {
        return doctorLookedService.deleteCaseContent(id,userAccount);
    }

    //修改保存黄页编号
    @RequestMapping(value = "/updateNumber", method = RequestMethod.POST)
    @ResponseBody
    public int updateNumber(String customerId, String yellowNumber,String abbreviation,String userAccount,String userId) {
        return doctorLookedService.updateNumber( customerId, yellowNumber, abbreviation, userAccount, userId);
    }

    // 添加就诊记录
    @RequestMapping(value = "/add_record")
    @ResponseBody
    public int addRecord(String customerId, String doctor, String diagnoseTime, String expenditureProject, String diagnoseDetail, String remarks,String abbreviation) throws Exception {
        return doctorLookedService.addRecord( customerId, doctor, diagnoseTime, expenditureProject, diagnoseDetail, remarks, abbreviation);
    }

    public List<PayServicedInfo> getDealInfoList(String operationTime, String reservationsId) throws Exception {
        return doctorLookedService.getDealInfoList(operationTime,reservationsId);
    }

    public List<IconInfo> getCurrentList(String num, String reservationsId) throws Exception {
        return doctorLookedService.getCurrentList(num,reservationsId);
    }

    // 医生的成交记录
    @RequestMapping(value = "/getOpenBillListRecord", method = RequestMethod.POST)
    @ResponseBody
    public List<PayServicedInfo> getOpenBillLisHuajia(String operationTime, String reservationsId,String abbreviation,String areaAbbreviation) {
        return doctorLookedService.getOpenBillLisHuajia(operationTime,reservationsId,abbreviation,areaAbbreviation);
    }

    /**
     * 查询 划价的记录
     */
    @RequestMapping(value = "/getOpenBillListf", method = RequestMethod.POST)
    @ResponseBody
    public List<PayServicedInfo> getOpenBillListf(String operationTime, String reservationsId,String abbreviation,String areaAbbreviation) {
        return doctorLookedService.getOpenBillListf(operationTime,reservationsId,abbreviation,areaAbbreviation);
    }

    /**
     * 医生列表
     */
    @RequestMapping("/list")
    @ResponseBody
    public Object testrInfoList(SearchDoctorLookedInfo info, HttpServletRequest request) {
        Page<DoctorLookedInfo> page = new PageFactory<DoctorLookedInfo>().defaultPage();
        if (info.getAbbreviation() == "" || info.getAbbreviation() == null || info.getAbbreviation() == "null") {
            return null;
        } else {
            try {
                info.setStartIndex(page.getSize() * (page.getCurrent() - 1));
                info.setLimitIndex(page.getSize());
                page.setCurrent(0);
                List<DoctorLookedInfo> list = doctorLookedService.selectPageListByQueryGetMap(page, info);
                if (list.size() == 0) {
                    info.setStartIndex(0);
                    list = doctorLookedService.selectPageListByQueryGetMap(page, info);
                }
                page.setTotal(doctorLookedService.getQueryPagesCount(page, info));
                page.setRecords(list);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return super.packForBT(page);
        }
    }

    /**
     * 今日操作
     */
    @RequestMapping("/operationList")
    @ResponseBody
    public Object operationList(SearchDoctorLookedInfo info, HttpServletRequest request) {
        Page<DoctorLookedInfo> page = new PageFactory<DoctorLookedInfo>().defaultPage();
        if (info.getAbbreviation() == "" || info.getAbbreviation() == null) {
            return null;
        } else {
            try {
                info.setStartIndex(page.getSize() * (page.getCurrent() - 1));
                info.setLimitIndex(page.getSize());
                page.setCurrent(0);
                List<DoctorLookedInfo> list = doctorLookedService.selectDoctorGetMap(page, info);
                if (list.size() == 0) {
                    info.setStartIndex(0);
                    list = doctorLookedService.selectDoctorGetMap(page, info);
                }
                page.setTotal(doctorLookedService.getQueryPagesDoctorCount(page, info));
                page.setRecords(list);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return super.packForBT(page);
        }
    }

    /**
     * 耗材新增
     */
    @RequestMapping(value = "/ensure", method = RequestMethod.POST)
    @ResponseBody
    public int ensure(String customerId, String reservationsId, String[] str, String doctor, String remarks ,String abbreviation) {
        return doctorLookedService.ensure(customerId,reservationsId,str,doctor,remarks,abbreviation);
    }

    /**
     * 机加工新增
     */
    @RequestMapping(value = "/ensure1", method = RequestMethod.POST)
    @ResponseBody
    public int checkOut(String customerId, String reservationsId, String[] str, String doctor, String remarks, String processUnit,
                        String status, String store, String picker, String phone, String deliveryTime, String pickUpTime ,String abbreviation) {

        return doctorLookedService.checkOut(customerId, reservationsId, str,  doctor, remarks, processUnit,
                status, store, picker, phone, deliveryTime,  pickUpTime, abbreviation);
    }

    /**
     * 医生耗材列表数据processingTableList
     */
    @RequestMapping(value = "/technologyTableList/{reservationsId}/{abbreviation}")
    @ResponseBody
    public List<DoctorTechnologyInfo> technologyTableList(@PathVariable String reservationsId, @PathVariable String abbreviation) throws Exception {
        return doctorLookedService.technologyTableList(reservationsId,abbreviation);
    }

    /**
     * 医生机加工列表数据
     */
    @RequestMapping(value = "/processingTableList/{reservationsId}")
    @ResponseBody
    public List<DoctorTechnologyProcessingInfo> processingTableList(@PathVariable String reservationsId,@PathVariable String abbreviation) throws Exception {
        return doctorLookedService.processingTableList(reservationsId,abbreviation);
    }

    //机加工修改
    @RequestMapping(value = "/update_technology", method = RequestMethod.POST)
    @ResponseBody
    public int updateTechnology(String doctor, String id, String remarks, String leftUp, String rightUp, String leftDown, String rightDown, String arrivalStore, String payServiceName,
                                String number, Double price, String type, String processUnit, String status, Double amount, Double amountActually) {
        return doctorLookedService.updateTechnology( doctor, id, remarks, leftUp, rightUp, leftDown, rightDown, arrivalStore, payServiceName,
                number, price, type, processUnit, status, amount, amountActually);
    }

    //耗材修改修改
    @RequestMapping(value = "/update_consumable", method = RequestMethod.POST)
    @ResponseBody
    public int updateConsumable(String doctor, String id, String remarks, String leftUp, String rightUp, String leftDown, String rightDown, String arrivalStore, String consumableName,
                                String number, String type, Double price, Double amount, Double amountActually) {
        return doctorLookedService.updateConsumable( doctor, id, remarks, leftUp, rightUp, leftDown, rightDown, arrivalStore, consumableName,number, type, price, amount, amountActually);
    }

    //删除机加工
    @RequestMapping(value = "/delete_process")
    @ResponseBody
    public int deleteProcess(String ids) {return doctorLookedService.deleteProcess(ids);}

    @RequestMapping(value = "/delete_tec")
    @ResponseBody
    public int deleteTec(String ids) { return doctorLookedService.deleteTec(ids); }

    /**
     * 医生业绩查询 表格
     */
    @RequestMapping("/queryList")
    @ResponseBody
    public Object queryList(SearchDoctorChangePriceInfo info,String abbreviation,String userAccount) {
        Page<DoctorChangePriceInfo> page = new PageFactory<DoctorChangePriceInfo>().defaultPage();
        try {
            List<DoctorChangePriceInfo> list = new ArrayList<DoctorChangePriceInfo>();
            if ("executive".equals(info.getDimensionSelection())) {
                info.setStartIndex(page.getSize() * (page.getCurrent() - 1));
                info.setLimitIndex(page.getSize());
                page.setCurrent(0);
                list = doctorLookedService.selectDoctorPerformanceGetMap(page, info,abbreviation,userAccount);
                if (list.size() == 0) {
                    info.setStartIndex(0);
                    list = doctorLookedService.selectDoctorPerformanceGetMap(page, info,abbreviation,userAccount);
                }
                page.setTotal(doctorLookedService.getQueryPagesPerformanceCount(page, info,abbreviation,userAccount));
                page.setRecords(list);
            } else if ("triage".equals(info.getDimensionSelection())) {
                info.setStartIndex(page.getSize() * (page.getCurrent() - 1));
                info.setLimitIndex(page.getSize());
                page.setCurrent(0);
                list = doctorLookedService.selectDoctorPerformanceGetFen(page, info,abbreviation,userAccount);
                if (list.size() == 0) {
                    info.setStartIndex(0);
                    list = doctorLookedService.selectDoctorPerformanceGetFen(page, info,abbreviation,userAccount);
                }
                page.setTotal(doctorLookedService.getQueryPagesCountFen(page, info,abbreviation,userAccount));
                page.setRecords(list);
            }
            page.setRecords(list);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return super.packForBT(page);
    }


    /**
     * 医生今日随访列表
     */
    @RequestMapping("/revisitList")
    @ResponseBody
    public Object doctorInfoList(SearchDoctorLookedInfo info, HttpServletRequest request) {
        Page<DoctorLookedInfo> page = new PageFactory<DoctorLookedInfo>().defaultPage();
        if(info.getAbbreviation()=="" || info.getAbbreviation() == null || info.getAbbreviation() =="null" ){
            return  null;
        }else{
            try {
                info.setStartIndex(page.getSize() * (page.getCurrent() - 1));
                info.setLimitIndex(page.getSize());
                page.setCurrent(0);
                List<DoctorLookedInfo> list = doctorLookedService.selectPageListByDoctorRevisit(page, info);
                if (list.size() == 0) {
                    info.setStartIndex(0);
                    list = doctorLookedService.selectPageListByDoctorRevisit(page, info);
                }
                page.setTotal(doctorLookedService.getQueryPagesRevisitCount(page, info));
                page.setRecords(list);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return super.packForBT(page);
        }
    }


    /**
     * 查看客户的所有病例列表(表格ajax 组件请求)
     */
    @RequestMapping(value = "/caseTableList/{customerId}/{abbreviation}")
    @ResponseBody
    public List<CaseInfo> caseTableList(@PathVariable String customerId, @PathVariable String abbreviation) throws Exception {
        return doctorLookedService.caseTableList(customerId,abbreviation);
    }

    /**
     * 删除回访
     */
    @RequestMapping(value = "/delete_revisit")
    @ResponseBody
    public int DeleteRevisit(String id,String userAccount, String roleName, String userId, String outpatientName ) throws Exception {
        return doctorLookedService.DeleteRevisit( id, userAccount,  roleName,  userId,  outpatientName);
    }

    /**
     * 病例数据添加
     */
    @RequestMapping(value = "/save")
    @ResponseBody
    public String add(CaseInfo info,String userAccount, String abbreviation, String userId, String outpatientName) throws Exception {
        info.setStatus(1);
        if (info.getArrivalStatus() != null) {
            doctorLookedService.updateCustomerArrivalStatus(info.getArrivalStatus(), info.getCustomerId(),abbreviation);
        }
        return doctorLookedService.insert(info);
    }

    @RequestMapping(value = "/updateS", method = RequestMethod.POST)
    @ResponseBody
    public int updateStatusS(String id) throws Exception { return doctorLookedService.updateStatusS(id);}

    /**
     * 病历点完成治疗
     */
    @RequestMapping(value = "/finshDraft")
    @ResponseBody
    public String finshDraft(CaseInfo info,String userAccount, String abbreviation, String userId, String outpatientName) throws Exception {
        info.setStatus(1);
        if (info.getArrivalStatus() != null) {
            doctorLookedService.updateCustomerArrivalStatus(info.getArrivalStatus(), info.getCustomerId(),abbreviation);
        }
        return doctorLookedService.insert1(info);
    }

    /**
     * 病例数据添加草稿
     */
    @RequestMapping(value = "/saveDraft")
    @ResponseBody
    public String saveDraft(@RequestParam("list") String list) throws Exception {
        //将对象转换成json字符串
        JSONObject jsStr = JSONObject.parseObject(list);
        CaseInfo caseInfo =  JSONObject.toJavaObject(jsStr,CaseInfo.class);;
        return doctorLookedService.insert(caseInfo);
    }

    /**
     * 项目是否结束
     */
    @RequestMapping(value = "/update_doctor_statusic", method = RequestMethod.POST)
    @ResponseBody
    public int choiceTc(String caseId, String statusic) throws Exception {return doctorLookedService.choiceTc(caseId,statusic);}

    /**
     * 病历模板层级
     */
    @RequestMapping(value = "/addBoLogValue", method = RequestMethod.POST)
    @ResponseBody
    public int addBoLogValue(String oneClass, String twoClass) throws Exception { return doctorLookedService.addBoLogValue(oneClass, twoClass); }

    /**
     * 统计查询
     */
    @RequestMapping(value = "/total", method = RequestMethod.GET)
    @ResponseBody
    public List<ConsultantInfo> change(String param1, String customerAgeEnd,
                                       String customerSex, String customerAgeStart, String doctor, String abbreviation) throws Exception {
        return doctorLookedService.change( param1, customerAgeEnd, customerSex, customerAgeStart, doctor, abbreviation);
    }

    @RequestMapping(value = "/addsf", method = RequestMethod.POST)
    @ResponseBody
    public int addsf(String remarks, String title, String userAccount) { return doctorLookedService.addsf( remarks, title, userAccount);
    }

    @RequestMapping(value = "/addjg", method = RequestMethod.POST)
    @ResponseBody
    public int addjg(String remarks, String title, String userAccount) { return doctorLookedService.addjg(remarks, title, userAccount);
    }

    @RequestMapping(value = "/addjz", method = RequestMethod.POST)
    @ResponseBody
    public int addjz(String remarks, String title, String userAccount) { return doctorLookedService.addjz(remarks, title, userAccount);
    }

    @RequestMapping(value = "/addsj", method = RequestMethod.POST)
    @ResponseBody
    public int addsj(String remarks, String title,String userAccount) {return doctorLookedService.addsj(remarks, title, userAccount);
    }

    /**
     * 再诊人  提交
     */
    @RequestMapping(value = "/zaizhen", method = RequestMethod.POST)
    @ResponseBody
    public int zaizhen(String zaiRemarks, String zaiPeople, String customerId, String abbreviation) {
        return doctorLookedService.zaizhen( zaiRemarks, zaiPeople, customerId, abbreviation);
    }

    @RequestMapping(value = "/getSfList", method = RequestMethod.POST)
    @ResponseBody
    public List<SfInfo> getSfList(String userAccount) {return doctorLookedService.getSfList(userAccount);}

    @RequestMapping(value = "/getJzList", method = RequestMethod.POST)
    @ResponseBody
    public List<SfInfo> getJzList(String userAccount) {
        List<SfInfo> list = doctorLookedService.getJzList(userAccount);
        return list;
    }

    @RequestMapping(value = "/getSjList", method = RequestMethod.POST)
    @ResponseBody
    public List<SfInfo> getSjList(String userAccount) {
        List<SfInfo> list = doctorLookedService.getSjList(userAccount);
        return list;
    }

    @RequestMapping(value = "/getJgList", method = RequestMethod.POST)
    @ResponseBody
    public List<JgInfo> getJgList(String userAccount) {
        List<JgInfo> list = doctorLookedService.getJgList(userAccount);
        return list;
    }

    @RequestMapping(value = "/getSfById", method = RequestMethod.POST)
    @ResponseBody
    public SfInfo getSfById(String id) {
        SfInfo info = doctorLookedService.getSfById(id);
        return info;
    }

    @RequestMapping(value = "/getJzById", method = RequestMethod.POST)
    @ResponseBody
    public SfInfo getJzById(String id) {
        SfInfo info = doctorLookedService.getJzById(id);
        return info;
    }

    @RequestMapping(value = "/getSjById", method = RequestMethod.POST)
    @ResponseBody
    public SfInfo getSjById(String id) {
        SfInfo info = doctorLookedService.getSjById(id);
        return info;
    }

    @RequestMapping(value = "/getJgById", method = RequestMethod.POST)
    @ResponseBody
    public SfInfo getJgById(String id) {
        SfInfo info = doctorLookedService.getJgById(id);
        return info;
    }

    /**
     * 保存修改病历
     */
    @RequestMapping(value = "/update_record")
    @ResponseBody
    public int updateRecord(@Valid CaseInfo info,String userAccount, String abbreviation, String userId, String outpatientName, BindingResult result) throws Exception {
        if (result.hasErrors()) {
            throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
        }
        try {
            info.setStatus(2);
            doctorLookedService.update(info, userAccount, abbreviation, userId, outpatientName);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return 1;
    }

    /**
     * 提交修改病历
     */
    @RequestMapping(value = "/update_records")
    @ResponseBody
    public int updateRecords(@Valid CaseInfo info,String userAccount, String abbreviation, String userId, String outpatientName, BindingResult result) throws Exception {
        if (result.hasErrors()) {
            throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
        }
        try {
            info.setStatus(1);
            doctorLookedService.update(info, userAccount, abbreviation, userId, outpatientName);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return 1;
    }

    /**
     * 完成修改病历
     */
    @RequestMapping(value = "/update_finsh")
    @ResponseBody
    public int updateFinsh(@Valid CaseInfo info, String abbreviation, BindingResult result) throws Exception {
        if (result.hasErrors()) {
            throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
        }
        try {
            info.setStatus(1);
            doctorLookedService.updateFinsh(info,abbreviation);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return 1;
    }

    /**
     * 除单个病例信息
     */
    @RequestMapping(value = "/deleteCase", method = RequestMethod.POST)
    @ResponseBody
    public int deleteCaseInfo(String id, String customerId, String abbreviation, String userAccount, String userId, String outpatientName) throws Exception {
        return doctorLookedService.deleteCaseInfo( id, customerId, abbreviation, userAccount, userId, outpatientName);
    }


    @RequestMapping(value = "/deleteCases", method = RequestMethod.POST)
    @ResponseBody
    public int deleteCases(String caseId) {return doctorLookedService.deleteCases(caseId);}

    @RequestMapping(value = "/changePriceTable/{reservationsId}")
    @ResponseBody
    public List<PayServicedInfo> changePriceTable(@PathVariable String reservationsId,@PathVariable String abbreviation,@PathVariable String userAccount,@PathVariable String areaAbbreviation) throws Exception {
        return doctorLookedService.changePriceTable( reservationsId, abbreviation,  userAccount,areaAbbreviation);
    }

    /**
     * 转诊  修改医生
     */
    @RequestMapping(value = "/updateDoctor", method = RequestMethod.POST)
    @ResponseBody
    public int updateDoctor(String doctor, String customerId, String remarks, String time, String optType ,String abbreviation, String userAccount, String userId, String outpatientName) {//optType 0:不强制执行  1:强制执行
        return doctorLookedService.updateDoctor( doctor, customerId, remarks, time, optType , abbreviation,  userAccount, userId, outpatientName);
    }

    /**
     * 转诊
     */
    @RequestMapping(value = "/referralerPerson", method = RequestMethod.POST)
    @ResponseBody
    public int referralerPerson(String referralerPersoned, String customerId, String remarks, String referralerPerson, String abbreviation) { return doctorLookedService.referralerPerson( referralerPersoned, customerId, remarks, referralerPerson, abbreviation);
    }

    /**
     * 划价记录  删除
     */
    @RequestMapping(value = "/delete_price")
    @ResponseBody
    public int deletePrice(String createTime) {return doctorLookedService.deletePrice(createTime);
    }

    /**
     * 医生划价 插入医生业绩表
     */
    @RequestMapping(value = "/insert_price")
    @ResponseBody
    public int changePrice(String id2, String customerId, String payServiceName, String remarks, Double accountArrears, Double serviceActualPay, Double deductionAmount, Integer payServiceNum, String abbreviation, String userAccount) {
        return doctorLookedService.changePrice( id2, customerId, payServiceName, remarks, accountArrears, serviceActualPay, deductionAmount, payServiceNum, abbreviation, userAccount);
    }

    /**
     * 医生划价记录
     */
    @RequestMapping(value = "/getPriceInfo")
    @ResponseBody
    public List<DoctorChangePriceInfo> getPriceInfo(String id2) {
        return doctorLookedService.getPriceInfo(id2);
    }

    /**
     * 医生开始治疗修改患者状态
     */
    @RequestMapping(value = "/startTreatment", method = RequestMethod.POST)
    @ResponseBody
    public int startTreatment(String customerId,String abbreviation,String userId,String userAccount,String outpatientName) {
        // webSocket.sendMessageViews("开始治疗", abbreviation);
        return doctorLookedService.startTreatment( customerId, abbreviation, userId, userAccount, outpatientName);
    }

    //完成治疗
    @RequestMapping(value = "/completionTreatment", method = RequestMethod.POST)
    @ResponseBody
    public int completionTreatment(String customerId,String abbreviation,String userId,String userAccount,String outpatientName) {
        // webSocket.sendMessageViews("完成治疗", abbreviation);
        return doctorLookedService.completionTreatment(customerId, abbreviation, userId, userAccount, outpatientName);
    }

    //回退
    @RequestMapping(value = "/returnTo", method = RequestMethod.POST)
    @ResponseBody
    public String returnTo(String customerId,String abbreviation) {
        return doctorLookedService.returnTo(customerId,abbreviation);
    }

    //患者取消预约
    @RequestMapping(value = "/cancelAppointmentok", method = RequestMethod.POST)
    @ResponseBody
    public int cancelAppointmentok(String customerId, String remarks,String abbreviation,String userId,String userAccount,String outpatientName) {
        // webSocket.sendMessageViews("取消预约", abbreviation);
        return doctorLookedService.cancelAppointmentok(customerId, remarks, abbreviation, userId, userAccount, outpatientName);
    }

    /**
     * 患者到店
     */
    @RequestMapping(value = "/regresses", method = RequestMethod.POST)
    @ResponseBody
    public int regresses(String customerId,String abbreviation,String outpatientName,String userAccount,String userId) {
        return doctorLookedService.regresses(customerId,abbreviation, outpatientName, userAccount, userId);
    }

    /**
     * 患者离开
     */
    @RequestMapping(value = "/alreadyLeave", method = RequestMethod.POST)
    @ResponseBody
    public int alreadyLeave(String customerId, String remarks,String abbreviation,String userId,String userAccount,String outpatientName) {
        //webSocket.sendMessageViews("已离开", abbreviation);
        return doctorLookedService.alreadyLeave(customerId, remarks, abbreviation, userId, userAccount, outpatientName);
    }

    /**
     * 点击确认
     */
    @RequestMapping(value = "/sureAppointment", method = RequestMethod.POST)
    @ResponseBody
    public int sureAppointment(String customerId,String abbreviation,String userId,String userAccount,String outpatientName) {
        return doctorLookedService.sureAppointment(customerId, abbreviation, userId, userAccount, outpatientName);
    }

    /**
     * 点击取消确认
     *
     * @param customerId
     * @return
     */
    @RequestMapping(value = "/no_sureAppointment", method = RequestMethod.POST)
    @ResponseBody
    public int no_sureAppointment(String customerId,String abbreviation,String userId,String userAccount,String outpatientName) {
        return doctorLookedService.no_sureAppointment(customerId,abbreviation,userId,userAccount,outpatientName);
    }

    /**
     * 回退
     */
    @RequestMapping(value = "/fallbackAction", method = RequestMethod.POST)
    @ResponseBody
    public int fallbackAction(String customerId, String arrivalStatus,String abbreviation,String userId,String userAccount,String outpatientName) {
        return doctorLookedService.fallbackAction(customerId, arrivalStatus, abbreviation, userId, userAccount, outpatientName);
    }

    /**
     * 添加随访
     */
    @RequestMapping(value = "/addDoctorContent", method = RequestMethod.POST)
    @ResponseBody
    public int addDoctorContent(String customerId, String doctor, String revisitTime,
                                String remarks, String reservationsId, String arrivalStore,String outpatientName) {
        return doctorLookedService.addDoctorContent(customerId, doctor, revisitTime, remarks,  reservationsId, arrivalStore, outpatientName);
    }

    /**
     * 保存  在随访
     */
    @RequestMapping(value = "/addDoctorContent2", method = RequestMethod.POST)
    @ResponseBody
    public int addDoctorContent2(String customerId, String doctor, String revisitContent, String revisitTime,
                                 String remarks, String reservationsId, String arrivalStore, String createName, String revisit,String userAccount,String userId,String outpatientName,String abbreviation) {
        return doctorLookedService.addDoctorContent2(  customerId, doctor, revisitContent, revisitTime,
                 remarks,  reservationsId,  arrivalStore,  createName,  revisit, userAccount, userId, outpatientName, abbreviation);
    }

    /**
     * 表格中 修改  保存在随访
     */
    @RequestMapping(value = "/addDoctorContents", method = RequestMethod.POST)
    @ResponseBody
    public int addDoctorContents(String customerId, String doctor, String revisitTime,
                                 String remarks, String reservationsId, String arrivalStore, String createName, String revisit,String outpatientName,String abbreviation) {
        return doctorLookedService.addDoctorContents(customerId, doctor, revisitTime,
                remarks, reservationsId, arrivalStore,  createName, revisit, outpatientName, abbreviation);
    }

    /**
     * 随访完成
     */
    @RequestMapping(value = "/addDoctorContent3", method = RequestMethod.POST)
    @ResponseBody
    public int addDoctorContent3(String customerId, String doctor, String revisitContent, String revisitTime,
                                 String remarks, String reservationsId, String arrivalStore, String createName, String revisit,String userAccount,String userId,String outpatientName,String abbreviation) {

        return doctorLookedService.addDoctorContent3( customerId,  doctor,  revisitContent,  revisitTime,
                 remarks,  reservationsId,  arrivalStore,  createName,  revisit, userAccount, userId, outpatientName, abbreviation);
    }

    /**
     * 随访未完成
     */
    @RequestMapping(value = "/addDoctorContent4", method = RequestMethod.POST)
    @ResponseBody
    public int addDoctorContent4(String customerId, String doctor, String revisitContent, String revisitTime,
                                 String remarks, String reservationsId, String arrivalStore, String createName, String revisit,String outpatientName,String abbreviation) {
        return doctorLookedService.addDoctorContent4(customerId, doctor, revisitContent, revisitTime,
                remarks, reservationsId, arrivalStore, createName, revisit, outpatientName, abbreviation);
    }

    /**
     * 随访取消
     */
    @RequestMapping(value = "/addDoctorContent5", method = RequestMethod.POST)
    @ResponseBody
    public int addDoctorContent5(String customerId, String doctor, String revisitContent, String revisitTime,
                                 String remarks, String reservationsId, String arrivalStore, String createName, String revisit,String outpatientName,String abbreviation) {
        return doctorLookedService.addDoctorContent5(customerId, doctor, revisitContent, revisitTime,
                remarks, reservationsId, arrivalStore, createName, revisit, outpatientName, abbreviation);
    }

    /**
     * 修改  随访保存
     */
    @RequestMapping(value = "/updateDoctorContent", method = RequestMethod.POST)
    @ResponseBody
    public int updateDoctorContent(String doctor, String createName,
                                   String revisitTime, String revisitContent, String doctorVisitId,
                                   String remarks, String customerId, String reservationsId, String revisit,String userAccount,String userId,String outpatientName,String abbreviation) {
        return doctorLookedService.updateDoctorContent(doctor, createName, revisitTime, revisitContent, doctorVisitId,
                remarks, customerId, reservationsId, revisit, userAccount, userId, outpatientName, abbreviation);
    }

    /**
     * 修改 完成随访
     */
    @RequestMapping(value = "/updateDoctorContent1", method = RequestMethod.POST)
    @ResponseBody
    public int updateDoctorContent1(String doctor, String createName,
                                    String revisitTime, String revisitContent, String doctorVisitId,
                                    String remarks, String reservationsId, String customerId, String revisit,String userAccount,String userId,String outpatientName) {
        return doctorLookedService.updateDoctorContent1(doctor, createName, revisitTime, revisitContent, doctorVisitId,
                remarks, reservationsId, customerId, revisit, userAccount, userId, outpatientName);
    }

    /**
     * 修改 随访未完成
     */
    @RequestMapping(value = "/updateDoctorContent2", method = RequestMethod.POST)
    @ResponseBody
    public int updateDoctorContent2(String doctor, String createName,
                                    String revisitTime, String revisitContent, String doctorVisitId,
                                    String remarks, String reservationsId, String revisit) {
        String sql = "update return_doctor_visit_info set doctor='" + doctor + "',create_name='" + createName
                + "',revisit_time='" + revisitTime + "',revisit_content='" + revisitContent
                + "',remarks='" + remarks + "',revisit='" + revisit + "',revisit_status='3' where reservations_id='" + reservationsId + "' and id='" + doctorVisitId + "'";
        return doctorLookedService.updateDoctorContent2(doctor, createName, revisitTime, revisitContent, doctorVisitId, remarks, reservationsId, revisit);
    }

    /**
     * 初始化下拉预约时间
     */
    @RequestMapping(value = "/diagnoseList", method = RequestMethod.POST)
    @ResponseBody
    public List<DoctorDiagnosisInfo> diagnoseList(String reservationsId) {
        //查询此人的看诊记录
        return doctorLookedService.diagnoseList(reservationsId);
    }

    /**
     * 上传图片(上传到项目的webapp/static/img)
     */
    @RequestMapping(method = RequestMethod.POST, path = "/uploadIcon/{cri}")
    @ResponseBody
    public String uploadIcon(@RequestPart("file") MultipartFile picture, @PathVariable String cri,
                             @PathVariable String outpatientName,@PathVariable String abbreviation,@PathVariable String userAccount,@PathVariable String userId) {
        return doctorLookedService.uploadIcon( picture, cri, outpatientName, abbreviation, userAccount, userId);
    }

    /**
     * 获得影像信息
     */
    @RequestMapping(path = "/getIconInfo/{cri}", method = RequestMethod.POST)
    @ResponseBody
    public List<IconInfo> getIconInfo(@PathVariable String cri,@PathVariable String areaAbbreviation) {
        return doctorLookedService.getIconInfo(cri, areaAbbreviation);
    }

    /**
     * 上传图片(上传到项目的webapp/static/img)
     */
    @RequestMapping(method = RequestMethod.POST, path = "/uploadIcons/{cri}")
    @ResponseBody
    public String uploadIcons(@RequestPart("file") MultipartFile picture, @PathVariable String abbreviation,
                              @PathVariable String outpatientName, @PathVariable String userAccount, @PathVariable String cri) {
        return doctorLookedService.uploadIcons(picture, abbreviation, outpatientName, userAccount, cri);
        //return MemberEnumConfig.ossphoeurl+imageurl1;
    }

    /**
     * 上传图片重命名(上传到项目的webapp/static/img)
     */
    @RequestMapping(method = RequestMethod.POST, path = "/submissionUploadIcons")
    @ResponseBody
    public String submissionUploadIcons(String cri,String abbreviation,String outpatientName,String userAccount) {
        return doctorLookedService.submissionUploadIcons(cri, abbreviation, outpatientName, userAccount);
    }

    //获取 图片
    @RequestMapping(value = "/getImgcancel", method = RequestMethod.POST)
    @ResponseBody
    public List<ApprovalProcessInfo> getImg(String num) throws Exception {return doctorLookedService.getImg(num);
    }

    //获取 图片
    @RequestMapping(value = "/getIntelligentImgcancel1", method = RequestMethod.POST)
    @ResponseBody
    public List<IconInfo> getIntelligentImgcancel1(String reservationsId, String num) throws Exception {return doctorLookedService.getIntelligentImgcancel1( reservationsId,  num);
    }

    //获取 图片
    @RequestMapping(value = "/getIntelligentImgcancel", method = RequestMethod.POST)
    @ResponseBody
    public List<IconInfo> getIntelligentImgcancel(String reservationsId, String num) throws Exception {return doctorLookedService.getIntelligentImgcancel( reservationsId,  num);
    }

    //删除图片
    @RequestMapping(value = "/delteCancel", method = RequestMethod.POST)
    @ResponseBody
    public int delteProcess(String id) throws Exception {
        return doctorLookedService.delteProcess(id);
    }

    //删除临时表 图片 以及路径下的文件
    @RequestMapping(value = "/delteCancel2", method = RequestMethod.POST)
    @ResponseBody
    public int delteProcess2(String id) throws Exception {
        return doctorLookedService.delteProcess2(id);
    }

    //删除正式表图片 以及路径下的文件
    @RequestMapping(value = "/delteCancel4", method = RequestMethod.POST)
    @ResponseBody
    public int delteProcess4(String customerId) throws Exception {
        return doctorLookedService.delteProcess4(customerId);
    }

    //删除整组打分影像
    @RequestMapping(value = "/deleteScoringIcons", method = RequestMethod.POST)
    @ResponseBody
    public int deleteScoringIcons(String num) throws Exception {
        return doctorLookedService.deleteScoringIcons(num);
    }

    /**
     * 医生排班
     *
     * @return
     */
    @RequestMapping(value = "/findDoctorSchedulingList/", method = RequestMethod.POST)
    @ResponseBody
    public List<DoctorSchedulingInfo> findDoctorSchedulingList(String startDate, String endDate, String outpatientName) {
        return doctorLookedService.findDoctorSchedulingList(startDate,endDate,outpatientName);
    }

    /**
     * 修改医生排班信息(点击正常班 休息)
     */
    @RequestMapping(value = "/updateStatus/", method = RequestMethod.POST)
    @ResponseBody
    public int updateDoctorStatus(String doctorName, String doctorId, String docTime, String docStatus, String outpatientName, String userAccount) {
        return doctorLookedService.updateDoctorStatus(doctorName, doctorId, docTime,  docStatus, outpatientName, userAccount);
    }

    /**
     * 预约视图  医生集合 接口 （起始时间  和  结束时间 ）根据角色用户查询 未指定医生、分诊医生
     */
    @RequestMapping(value = "/getListedDoctor/{timeSlot}")
    @ResponseBody
    public List<ConsultantsoInfo> getListedDoctor(@PathVariable String timeSlot) {
        return doctorLookedService.getListedDoctor(timeSlot);
    }

    /**
     * 预约视图  医生集合 接口 （起始时间  和  结束时间 ）根据角色用户查询所有医生
     */
    @RequestMapping(value = "/getListed/{timeSlot}")
    @ResponseBody
    public List<ConsultantdInfo> getListed(@PathVariable String timeSlot) {
        return doctorLookedService.getListed(timeSlot);
    }

    /**
     * 预约视图  医生集合 接口 （起始时间  和  结束时间 ） 未上班下面有预约患者的医生
     */
    @RequestMapping(value = "/consultRestDoctor/{timeSlot}")
    @ResponseBody
    public List<ConsultantsInfo> consultRestDoctor(@PathVariable String timeSlot) {
        return doctorLookedService.consultRestDoctor(timeSlot);
    }

    /**
     * 查找数据源
     */
    @RequestMapping(value = "/getDataList/{timeSlot}")
    @ResponseBody
    public List<ConsultantInfo> getDataList(@PathVariable String timeSlot) {
        return doctorLookedService.getDataList(timeSlot);
    }

    /**
     * 预约视图  医生集合 接口 （起始时间  和  结束时间 ）根据角色用户查询所有洁牙师
     */
    @RequestMapping(value = "/getJysListed/{timeSlot}")
    @ResponseBody
    public List<ConsultantdInfo> getJysListed(@PathVariable String timeSlot) {
        return doctorLookedService.getJysListed(timeSlot);
    }

    /**
     * 当前登录医生查找数据源
     */
    @RequestMapping(value = "/getDataListByDoctor/{timeSlot}/{abbreviation}")
    @ResponseBody
    public List<ConsultantInfo> getDataListByDoctor(@PathVariable String timeSlot,@PathVariable String abbreviation) {
        return doctorLookedService.getDataListByDoctor(timeSlot, abbreviation);
    }

    /**
     * 获取医生当前的休息状态
     */
    @RequestMapping(value = "/getDoctorStatus", method = RequestMethod.POST)
    @ResponseBody
    public String getDoctorStatus(String doctor, String value,String outpatientName) {
        return doctorLookedService.getDoctorStatus(doctor, value, outpatientName);
    }

    /**
     * 获得此医生本周休息的日期
     */
    @RequestMapping(value = "/getRestingState/{timeSlot}/{outpatientName}", method = RequestMethod.POST)
    @ResponseBody
    public List<DoctorSchedulingInfo> getRestingState(@PathVariable String timeSlot,@PathVariable String outpatientName) {return doctorLookedService.getRestingState(timeSlot, outpatientName);
    }

    /**
     * 当前个人医生视图查找数据源  传开始时间和结束时间(一周时间)  医生ID
     */
    @RequestMapping(value = "/getDataDoctor/{timeSlot}/{abbreviation}")
    @ResponseBody
    public List<ConsultantInfo> getDataDoctor(@PathVariable String timeSlot,@PathVariable String abbreviation) {
        return doctorLookedService.getDataDoctor( timeSlot, abbreviation);
    }

    /**
     * 当前个人医生视图查找数据源  传开始时间和结束时间(一天时间)  医生ID
     */
    @RequestMapping(value = "/getOneDoctor/{timeSlot}/{abbreviation}")
    @ResponseBody
    public List<ConsultantInfo> getOneDoctor(@PathVariable String timeSlot,@PathVariable String abbreviation) {
        return doctorLookedService.getOneDoctor( timeSlot, abbreviation);
    }

    /**
     * 上传根管(上传到项目的webapp/static/img)
     */
    //@Transactional
    @RequestMapping(method = RequestMethod.POST, path = "/upLoadOrthodontics1/{cri}/{userAccount}")
    @ResponseBody
    public String upLoadOrthodontics1(@RequestPart("file") MultipartFile picture, @PathVariable String cri,@PathVariable String userAccount) {
        return doctorLookedService.upLoadOrthodontics1( picture, cri, userAccount);
    }

    /**
     * 上传正畸(上传到项目的webapp/static/img)
     */
    //@Transactional
    @RequestMapping(method = RequestMethod.POST, path = "/upLoadOrthodontics/{cri}/{userAccount}")
    @ResponseBody
    public String upLoadOrthodontics(@RequestPart("file") MultipartFile picture,@PathVariable String userAccount,
                                     @PathVariable String cri) {
        return doctorLookedService.upLoadOrthodontics(picture, cri,userAccount);
    }

    /**
     * 上传根管(上传到项目的webapp/static/img)
     */
    //@Transactional
    @RequestMapping(method = RequestMethod.POST, path = "/upLoadRootCanal/{cri}/{userAccount}")
    @ResponseBody
    public String upLoadRootCanal(@RequestPart("file") MultipartFile picture,@PathVariable String userAccount,
                                  @PathVariable String cri) {
        return doctorLookedService.upLoadRootCanal(picture, cri, userAccount);
    }

    /**
     * 上传潔牙(上传到项目的webapp/static/img)
     */
    @RequestMapping(method = RequestMethod.POST, path = "/uploadScaling/{cri}/{userAccount}")
    @ResponseBody
    public String uploadScaling(@RequestPart("file") MultipartFile picture,@PathVariable String userAccount,
                                @PathVariable String cri) {
        return doctorLookedService.uploadScaling(picture, cri, userAccount);
    }

    /**
     * 上传牙周(上传到项目的webapp/static/img)
     */
    @RequestMapping(method = RequestMethod.POST, path = "/uploadPeriodontal/{cri}/{userAccount}")
    @ResponseBody
    public String uploadPeriodontal(@RequestPart("file") MultipartFile picture,@PathVariable String userAccount,
                                    @PathVariable String cri) {
        return doctorLookedService.uploadPeriodontal(picture, cri, userAccount);
    }

    /**
     * 上传种植(上传到项目的webapp/static/img)
     */
    @RequestMapping(method = RequestMethod.POST, path = "/uploadPlantScoreFirst/{cri}/{userAccount}")
    @ResponseBody
    public String uploadPlantScoreFirst(@RequestPart("file") MultipartFile picture,@PathVariable String userAccount,
                                        @PathVariable String cri) {
        return doctorLookedService.uploadPlantScoreFirst(picture, cri, userAccount);
    }

    /**
     * 上传修复(上传到项目的webapp/static/img)
     */
    @RequestMapping(method = RequestMethod.POST, path = "/uploadRepair/{cri}/{userAccount}")
    @ResponseBody
    public String uploadRepair(@RequestPart("file") MultipartFile picture,@PathVariable String userAccount,
                               @PathVariable String cri) {
        return doctorLookedService.uploadRepair(picture, cri, userAccount);
    }

    /**
     * 缓存上传正畸
     */
    @RequestMapping(value = "/storageOrthodontics", method = RequestMethod.POST)
    @ResponseBody
    public int storageOrthodontics(String reservationsId, String num, String doctor, String nurse, String customerName, String sex,
                                   String orthodonticsAge, String orthodonticDesign,
                                   String congestionDegree, String coveringCoverage, String molarRelationship,
                                   String canineRelationship, String designScheme, String userAccount, String outpatientName) throws Exception {
        return doctorLookedService.storageOrthodontics(reservationsId, num,  doctor, nurse, customerName,  sex, orthodonticsAge, orthodonticDesign,
                congestionDegree, coveringCoverage,  molarRelationship,
                canineRelationship, designScheme,  userAccount,  outpatientName);
    }

    /**
     * 正畸 初诊 暂存打分
     */
    @RequestMapping(value = "/orthodonticScoring", method = RequestMethod.POST)
    @ResponseBody
    public int orthodonticScoring(String reservationsId, String num, String a1, String a2, String a3, String a4, String a5, String a6, String a7, String C1, String C2, String C3, String C4, String C5, String C6, String degreeRadio, String expertComment1, String expertComment2, String userAccount) throws Exception {
        return doctorLookedService.orthodonticScoring( reservationsId,  num,  a1,  a2,  a3,  a4,  a5,  a6,  a7,  C1,  C2, C3,  C4, C5,  C6, degreeRadio, expertComment1,  expertComment2, userAccount);
    }

    /**
     * 提交上传正畸
     */
    @RequestMapping(value = "/subOrthodontics", method = RequestMethod.POST)
    @ResponseBody
    public int subOrthodontics(String reservationsId, String num, String doctor, String nurse, String customerName, String sex, String orthodonticsAge, String orthodonticDesign,
                               String congestionDegree, String coveringCoverage, String molarRelationship, String canineRelationship, String designScheme,
                               String medicalRecordNumberValue,String userAccount,String outpatientName) throws Exception {
        return doctorLookedService.subOrthodontics( reservationsId,  num,  doctor,  nurse,  customerName,  sex,  orthodonticsAge,  orthodonticDesign,
                congestionDegree,  coveringCoverage,  molarRelationship,  canineRelationship,  designScheme,
                medicalRecordNumberValue, userAccount, outpatientName);
    }

    /**
     * 提交2上传正畸
     */
    @RequestMapping(value = "/subOrthodontics2", method = RequestMethod.POST)
    @ResponseBody
    public int subOrthodontics2(String reservationsId, String num, String doctor, String nurse, String customerName, String sex, String orthodonticsAge, String orthodonticDesign,
                                String congestionDegree, String coveringCoverage, String molarRelationship, String canineRelationship, String designScheme,
                                String medicalRecordNumberValue,String userAccount,String outpatientName) throws Exception {
        return doctorLookedService.subOrthodontics2( reservationsId,  num,  doctor,  nurse,  customerName,  sex,  orthodonticsAge,  orthodonticDesign,
                congestionDegree,  coveringCoverage,  molarRelationship,  canineRelationship,  designScheme,
                medicalRecordNumberValue, userAccount, outpatientName);
    }

    /**
     * 缓存上传正畸完成
     */
    @RequestMapping(value = "/storageOrthodonticsd", method = RequestMethod.POST)
    @ResponseBody
    public int storageOrthodonticsd(String reservationsId, String num, String doctor, String nurse, String molarTooth, String canineTooth, String overlap, String userAccount) throws Exception {
        return doctorLookedService.storageOrthodonticsd( reservationsId,  num, doctor, nurse, molarTooth, canineTooth, overlap, userAccount);
    }


    /**
     * 提交正畸打分
     */
    @RequestMapping(value = "/subCore", method = RequestMethod.POST)
    @ResponseBody
    public int subCore(String reservationsId, String num, String a1, String a2, String a3, String a4, String a5, String a6, String a7,
                       String C1, String C2, String C3, String C4, String C5, String C6, String degreeRadio, String expertComment1, String expertComment2, String userAccount) throws Exception {
        return doctorLookedService.subCore(reservationsId, num, a1, a2, a3, a4, a5, a6, a7,C1, C2, C3, C4, C5, C6, degreeRadio, expertComment1, expertComment2, userAccount);
    }

    /**
     * 提交正畸打分
     */
    @RequestMapping(value = "/subCoreB", method = RequestMethod.POST)
    @ResponseBody
    public int subCoreB(String reservationsId, String num, String b1, String b2, String b3, String b4, String b5) throws Exception {
        return doctorLookedService.subCoreB(reservationsId, num, b1, b2, b3, b4, b5);
    }

    /**
     * 提交上传正畸完成
     */
    @RequestMapping(value = "/subOrthodonticsd", method = RequestMethod.POST)
    @ResponseBody
    public int subOrthodonticsd(String reservationsId, String num, String doctor, String nurse, String molarTooth, String canineTooth, String overlap, String medicalRecordNumberValue, String userAccount) throws Exception {
        return doctorLookedService.subOrthodonticsd(reservationsId, num, doctor, nurse, molarTooth, canineTooth, overlap, medicalRecordNumberValue, userAccount);
    }

    /**
     * 删除正畸初诊 暂存
     */
    @RequestMapping(value = "/deleteOrthodonticScore", method = RequestMethod.POST)
    @ResponseBody
    public int deleteOrthodonticScore(String ids) throws Exception {
        return doctorLookedService.deleteOrthodonticScore(ids);
    }

    /**
     * 删除正畸完成 暂存
     */
    @RequestMapping(value = "/deleteOrthodonticScore1", method = RequestMethod.POST)
    @ResponseBody
    public int deleteOrthodonticScore1(String ids) throws Exception {
        return doctorLookedService.deleteOrthodonticScore1(ids);
    }

    /**
     * 缓存上传种植
     */
    @RequestMapping(value = "/storagePlant", method = RequestMethod.POST)
    @ResponseBody
    public int storagePlant(String reservationsId, String num, String customerName, String doctor, String nurse,String userAccount,String outpatientName ) throws Exception {
        return doctorLookedService.storagePlant(reservationsId,  num, customerName, doctor, nurse, userAccount, outpatientName);
    }

    /**
     * 提交上传种植
     */
    @RequestMapping(value = "/subPlant", method = RequestMethod.POST)
    @ResponseBody
    public int subPlant(String reservationsId, String num, String doctor1, String nurse1, String customerName,String userAccount,String outpatientName) throws Exception {
        return doctorLookedService.subPlant(reservationsId,  num, customerName, doctor1, nurse1, userAccount, outpatientName);
    }

    /**
     * 删除 缓存种植
     */
    @RequestMapping(value = "/deleteSubPlant", method = RequestMethod.POST)
    @ResponseBody
    public int deleteSubPlant(String ids) throws Exception {
        return doctorLookedService.deleteSubPlant(ids);
    }

    /**
     * 缓存上传根管
     */
    @RequestMapping(value = "/storageRootCanal", method = RequestMethod.POST)
    @ResponseBody
    public int storageRootCanal(String reservationsId, String num, String treatmentTypes, String consumptionAmount, String toothPositionA,
                                String toothPositionB, String toothPositionC, String toothPositionD, String toothPosition, String doctor, String nurse, String customerName,String userAccount,String outpatientName) throws Exception {
        return doctorLookedService.storageRootCanal(reservationsId, num, treatmentTypes, consumptionAmount, toothPositionA,
                toothPositionB, toothPositionC, toothPositionD,  toothPosition, doctor, nurse, customerName, userAccount, outpatientName);
    }

    /**
     * 提交上传根管
     */
    @RequestMapping(value = "/subRootCanal", method = RequestMethod.POST)
    @ResponseBody
    public int subRootCanal(String reservationsId, String num, String treatmentTypes, String consumptionAmount, String toothPositionA, String doctor, String nurse, String customerName,
                            String toothPositionB, String toothPositionC, String toothPositionD, String toothPosition,String userAccount,String outpatientName) throws Exception {
        return doctorLookedService.subRootCanal( reservationsId,  num,  treatmentTypes,  consumptionAmount,  toothPositionA,  doctor,  nurse,  customerName,
                toothPositionB, toothPositionC, toothPositionD,  toothPosition, userAccount, outpatientName);
    }

    /**
     * 删除暂存根管
     */
    @RequestMapping(value = "/deleteRootCanal", method = RequestMethod.POST)
    @ResponseBody
    public int deleteRootCanal(String ids) throws Exception {return doctorLookedService.deleteRootCanal(ids);
    }

    /**
     * 缓存上传牙周
     */
    @RequestMapping(value = "/storagePeriodontal", method = RequestMethod.POST)
    @ResponseBody
    public int storagePeriodontal(String reservationsId, String num, String customerName, String doctor, String nurse,String userAccount,String outpatientName) throws Exception {
        return doctorLookedService.storagePeriodontal(reservationsId,  num, customerName, doctor, nurse, userAccount, outpatientName);
    }

    /**
     * 提交上传牙周
     */
    @RequestMapping(value = "/subPeriodontal", method = RequestMethod.POST)
    @ResponseBody
    public int subPeriodontal(String reservationsId, String num, String doctor, String nurse, String customerName,String userAccount,String outpatientName) throws Exception {
        return doctorLookedService.subPeriodontal(reservationsId,  num,  doctor,  nurse, customerName, userAccount, outpatientName);
    }

    /**
     * 删除 缓存牙周
     */
    @RequestMapping(value = "/deleteStoragePeriodontal", method = RequestMethod.POST)
    @ResponseBody
    public int deleteStoragePeriodontal(String ids) throws Exception {return doctorLookedService.deleteStoragePeriodontal(ids);
    }

    /**
     * 缓存上传洁牙
     */
    @RequestMapping(value = "/storageScaling", method = RequestMethod.POST)
    @ResponseBody
    public int storageScaling(String reservationsId, String num, String customerName, String doctor, String nurse,String userAccount,String outpatientName) throws Exception {
        return doctorLookedService.storageScaling(reservationsId, num, customerName, doctor, nurse, userAccount, outpatientName);
    }

    /**
     * 提交上传洁牙
     */
    @RequestMapping(value = "/subScaling", method = RequestMethod.POST)
    @ResponseBody
    public int subScaling(String reservationsId, String num, String doctor, String nurse, String customerName,String userAccount,String outpatientName) throws Exception { return doctorLookedService.subScaling(reservationsId, num,  doctor,  nurse,  customerName, userAccount, outpatientName);
    }

    /**
     * 删除 缓存洁牙
     */
    @RequestMapping(value = "/deleteSubScaling", method = RequestMethod.POST)
    @ResponseBody
    public int deleteSubScaling(String ids) throws Exception {return doctorLookedService.deleteSubScaling(ids);
    }

    /**
     * 缓存上传修复
     */
    @RequestMapping(value = "/storageRepair", method = RequestMethod.POST)
    @ResponseBody
    public int storageRepair(String reservationsId, String num, String customerName, String doctor, String nurse,String userAccount,String outpatientName) throws Exception {
        return doctorLookedService.storageRepair(reservationsId, num, customerName, doctor, nurse, userAccount, outpatientName);
    }

    /**
     * 提交上传修复
     */
    @RequestMapping(value = "/subRepair", method = RequestMethod.POST)
    @ResponseBody
    public int subRepair(String reservationsId, String num, String doctor, String nurse, String customerName,String userAccount,String outpatientName) throws Exception {
        return doctorLookedService.subRepair(reservationsId, num, doctor, nurse, customerName, userAccount, outpatientName);
    }

    //修改正畸上传成可编辑状态
    @RequestMapping(value = "/updateOrthodonticsStatus", method = RequestMethod.POST)
    @ResponseBody
    public int subRepair(String id) throws Exception {return doctorLookedService.subRepair(id);
    }

    /**
     * 删除 缓存修复
     */
    @RequestMapping(value = "/deleteSubRepair", method = RequestMethod.POST)
    @ResponseBody
    public int deleteSubRepair(String ids) throws Exception {return doctorLookedService.deleteSubRepair(ids);
    }

    /**
     * 刪除上传更管
     */
    @RequestMapping(value = "/deleteRootCanalImgs", method = RequestMethod.POST)
    @ResponseBody
    public int deleteRootCanalImgs(String id) throws Exception {return doctorLookedService.deleteRootCanalImgs(id);
    }

    /**
     * 刪除上传洁牙
     */
    @RequestMapping(value = "/deleteScalingImgs", method = RequestMethod.POST)
    @ResponseBody
    public int deleteScalingImgs(String id) throws Exception { return doctorLookedService.deleteScalingImgs(id);
    }

    /**
     * 刪除上传牙周
     */
    @RequestMapping(value = "/deletePeriodontalImgs", method = RequestMethod.POST)
    @ResponseBody
    public int deletePeriodontalImgs(String id) throws Exception { return doctorLookedService.deletePeriodontalImgs(id);
    }

    /**
     * 刪除上传正畸
     */
    @RequestMapping(value = "/deleteOrthodonticsImgs", method = RequestMethod.POST)
    @ResponseBody
    public int deleteOrthodontics(String id) throws Exception {return doctorLookedService.deleteOrthodontics(id);
    }

    /**
     * 刪除上传种植
     */
    @RequestMapping(value = "/deletePlantImgs", method = RequestMethod.POST)
    @ResponseBody
    public int deletePlantImgs(String id) throws Exception { return doctorLookedService.deletePlantImgs(id);
    }

    /**
     * 刪除上传修复
     */
    @RequestMapping(value = "/deleteRepairImgs", method = RequestMethod.POST)
    @ResponseBody
    public int deleteRepairImgs(String id) throws Exception {return doctorLookedService.deleteRepairImgs(id);
    }

    /**
     * 新增看诊项目
     */
    @RequestMapping(value = "/add_diagnose", method = RequestMethod.POST)
    @ResponseBody
    public int addDiagnose(String projectCategory, String projectName ,String userAccount) throws Exception {
        return doctorLookedService. addDiagnose( projectCategory,  projectName , userAccount);
    }

    /**
     * 修改看诊项目
     */
    @RequestMapping(value = "/update_diagnose", method = RequestMethod.POST)
    @ResponseBody
    public int updateDiagnose(String id, String projectCategory, String projectName,String userAccount) throws Exception {return doctorLookedService.updateDiagnose( id,  projectCategory,  projectName, userAccount);
    }

    /**
     * 删除看诊项目
     */
    @RequestMapping(value = "/delete_diagnose", method = RequestMethod.POST)
    @ResponseBody
    public int deleteDiagnose(String id) throws Exception { return doctorLookedService.deleteDiagnose( id);
    }
















}
















































